package com.dhcc.sdc.base.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.dhcc.core.framework.base.service.impl.BaseServiceImpl;
import com.dhcc.sdc.base.dao.SdcBaseAssessmenentryMapper;
import com.dhcc.sdc.base.dao.SdcBaseAssessmenitemMapper;
import com.dhcc.sdc.base.entity.SdcBaseAssessmenentryEntity;
import com.dhcc.sdc.base.entity.SdcBaseAssessmenitemEntity;
import com.dhcc.sdc.base.service.ISdcBaseAssessmenitemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 表数据服务层接口
 * 
 * @ClassName: SdcBaseAssessmenitemServiceImpl
 * @Description: TODO
 * @author jumper
 * @date 2021-09-14 16:35:21
 */
@Service("sdcBaseAssessmenitemService")
public class SdcBaseAssessmenitemServiceImpl extends BaseServiceImpl<SdcBaseAssessmenitemMapper, SdcBaseAssessmenitemEntity> implements ISdcBaseAssessmenitemService {

	@Autowired
	private SdcBaseAssessmenentryMapper sdcBaseAssessmenentryMapper;

	@Override
	public List<SdcBaseAssessmenitemEntity> page(Page<SdcBaseAssessmenitemEntity> page, Map<String, Object> map) {
		return this.baseMapper.page(page, map);
	}
	@Override
	public List<SdcBaseAssessmenitemEntity> list(Map<String, Object> map) {
		return this.baseMapper.list(map);
	}

	@Override
	public void addDict(SdcBaseAssessmenitemEntity asmtItem, String entryList) {

	}

	@Override
	public void editDict(SdcBaseAssessmenitemEntity asmtItem, String entryList) {

	}

	@Override
	@Transactional
	public void delteDict(Long asmtItemId) {
		// 删除这一条目的所有选项
		Wrapper<SdcBaseAssessmenentryEntity> entryWrapper = new EntityWrapper<>();
		entryWrapper = entryWrapper.eq("item_id", asmtItemId);
		sdcBaseAssessmenentryMapper.delete(entryWrapper);

		// 删除这个条目
		baseMapper.deleteById(asmtItemId);
	}
}